package com.ojoin.trade.common.web.jcaptcha;

import javax.servlet.http.HttpServletRequest;

public class JCaptcha {
    public static final VerifyCodeImgValidaterService captchaService
            = new VerifyCodeImgValidaterService();
    
	public static boolean hasCaptcha(HttpServletRequest request,
			String userCaptchaResponse) {
		if (request.getSession(false) == null)
			return false;
		boolean validated = false;
		String id = request.getSession().getId();
		validated = captchaService.hasCapcha(id, userCaptchaResponse);
		return validated;
	}
	
	public static boolean hasCaptcha(String sessionId,
			String userCaptchaResponse) {
		if (sessionId == null)
			return false;
		boolean validated =  captchaService.hasCapcha(sessionId, userCaptchaResponse);
		return validated;
	}
	
}
